<template>
  <transition name="van-fade">
    <van-overlay :show="!closed">
      <div class="notice">
        <div class="content">
          <div class="txt">
            {{ notice }}
          </div>
        </div>
        <div style="text-align:center;">
          <div class="closeNotice" @click="closeNotice">
            <van-icon name="cross" />
          </div>
        </div>
      </div>
    </van-overlay>
  </transition>
</template>

<script>
export default {
  name: "full-notice",
  props: ["notice"],
  data() {
    return {
      closed: true
    };
  },
  watch: {
    notice() {
      let closed = window.sessionStorage.getItem("fullNoticeClose");
      // console.log(closed == null, this.notice != null);
      if (closed == null && this.notice != null) {
        this.closed = false;
      }
    }
  },
  methods: {
    showNotice() {
      this.closed = false;
    },
    closeNotice() {
      this.closed = true;
      window.sessionStorage.setItem("fullNoticeClose", true);
    }
  },
  created() {
    let closed = window.sessionStorage.getItem("fullNoticeClose");
    if (null != closed) this.closed = closed;
  }
};
</script>

<style lang="less" scoped>
.notice {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(129, 129, 129, 0.3);
  z-index: 99999999;
  transition: 100ms;
  .content {
    width: 300px;
    min-height: 100px;
    margin: auto;
    margin-top: 200px;
    background-color: #fff;
    background: #fff url("../assets/notice_bg.png") no-repeat center;
    background-size: 100%;
    background-position: top;
    font-size: 15px;
    color: #888;
    letter-spacing: 1px;
    border-radius: 10px;
    .txt {
      width: 260px;
      margin: auto;
      padding: 70px 5px 20px 5px;
      text-align: justify;
    }
  }
  .closeNotice {
    border: 2px solid #fff;
    color: #fff;
    border-radius: 50%;
    display: inline-block;
    height: 20px;
    width: 20px;
    line-height: 22px;
    font-size: 10px;
    text-align: center;
    margin: auto;
    margin-top: 20px;
  }
}
</style>
